<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<script>
description("HTMLTextAreaElement rows attribute test");

function rowsAttributeEffect(value)
{
    var element = document.createElement("textarea");
    element.setAttribute("rows", value);
    return element.rows;
}

shouldBe('document.createElement("textarea").rows', '2');

shouldBe('rowsAttributeEffect("")', '2');

shouldBe('rowsAttributeEffect("1")', '1');
shouldBe('rowsAttributeEffect("2")', '2');
shouldBe('rowsAttributeEffect("10")', '10');

shouldBe('rowsAttributeEffect("0")', '2');

shouldBe('rowsAttributeEffect("-1")', '2');

shouldBe('rowsAttributeEffect("1x")', '1');
shouldBe('rowsAttributeEffect("1.")', '1');
shouldBe('rowsAttributeEffect("1.9")', '1');
shouldBe('rowsAttributeEffect("2x")', '2');
shouldBe('rowsAttributeEffect("2.")', '2');
shouldBe('rowsAttributeEffect("2.9")', '2');

shouldBe('rowsAttributeEffect("a")', '2');
shouldBe('rowsAttributeEffect("\v7")', '2');
shouldBe('rowsAttributeEffect("  7")', '7');

var arabicIndicDigitOne = String.fromCharCode(0x661);
shouldBe('rowsAttributeEffect(arabicIndicDigitOne)', '2');
shouldBe('rowsAttributeEffect("2" + arabicIndicDigitOne)', '2');

// Verify that values >= 2^31 result in the default value.
shouldBe('rowsAttributeEffect("2147483646")', '2147483646');
shouldBe('rowsAttributeEffect("2147483647")', '2147483647');
shouldBe('rowsAttributeEffect("2147483648")', '2');
shouldBe('rowsAttributeEffect("2147483649")', '2');
// Verify that 2^32 is no special boundary at all.
shouldBe('rowsAttributeEffect("4294967295")', '2');
shouldBe('rowsAttributeEffect("4294967296")', '2');
shouldBe('rowsAttributeEffect("4294967297")', '2');
</script>
</body>
</html>
